Issue with DBE placement

I have a dialog box that we've used about 2 years now. It's worked fine for the last two blocks of the project. Now I'm just making little updates to bring it up to date for the latest block and for some reason some the DBEs at the bottom of the dialog box are not placing themselves as they should be. Changing the code from using my attach() method to just normal constrained placement doesn't fix the problem. Anyone else have this problem?

Here is the code. You'll need to get my attach.inc file from kevin murphy's site and change the include path.
http://www.baselinesinc.com/?page_id=11&filerepoaction=showpost&filepost_id=5
 

#include <Attach.inc>
 
DB addROMs_DB;
DBE rom_TaskFilter_DBE;
DBE rom_TaughtFilter_DBE;
DBE rom_ApplyFilter_DBE;
DBE rom_ChooseDate_DBE;
DBE rom_DTOSDate_DBE;
DBE rom_ChooseLabel_DBE;
DBE rom_ChooseROM_DBE;
DBE rom_Name_DBE;
DBE rom_TaughtStatus_DBE;
DBE rom_MTD_DBE;
DBE rom_Counter_DBE;
DBE rom_Task_DBE;
DBE rom_SSSN_DBE;
DBE rom_Requirement_DBE;
DBE rom_Next_DBE;
DBE rom_Previous_DBE;
DBE rom_Create_DBE;
DBE rom_CreateAll_DBE;
DBE rom_NoImpact_DBE;
DBE rom_MergeWith_DBE;
DBE rom_NameLabel_DBE;
DBE sep2;
 
void closeDB(DB dbox) {
   hide(dbox);
   destroy(dbox);
   dbox = null;
}
 
void applyTaskFilter(DBE clicked) {}
void setNoImpact(DBE clicked) {}
void moveToPreviousObject(DBE clicked) {}
void moveToNextObject(DBE clicked) {}
void createROM(DBE clicked) {}
void createAllROM(DBE clicked) {}
void mergeROM(DBE clicked) {}
 
string taughtStatuses[3] = {"Either", "Formally Taught", "Not Formally Taught"};
   string tasks[1] = {"Any"};
   
   addROMs_DB = create("Analyze Impacts", styleCentered|styleFixed)
   
   rom_TaskFilter_DBE = choice(addROMs_DB, "View Impacts in Task: ", tasks, 0, 20, false);
   attach(rom_TaskFilter_DBE, "l->f;r->u;t->f;b->u");
   
   rom_TaughtFilter_DBE = choice(addROMs_DB, "Show Tasks that are: ", taughtStatuses, 1, 20, false);
   attach(rom_TaughtFilter_DBE, "l->f;r->u;t->s;b->u", rom_TaskFilter_DBE);
   
   rom_ApplyFilter_DBE = button(addROMs_DB, "Apply Filter", applyTaskFilter);
   attach(rom_ApplyFilter_DBE, "l->u;r->f;t->s;b->u", rom_TaskFilter_DBE);
   
   DBE sep1 = separator(addROMs_DB);
   attach(sep1, "l->f;r->f;t->s;b->u", rom_TaughtFilter_DBE);
   
   rom_ChooseDate_DBE = label(addROMs_DB, "Choose TO DTOS Month(only the month and year will be used):");
   attach(rom_ChooseDate_DBE, "l->f;r->u;t->s;b->u", sep1);
   
   rom_DTOSDate_DBE = date(addROMs_DB, 35, today, true);
   attach(rom_DTOSDate_DBE, "l->f;r->u;t->s;b->u", rom_ChooseDate_DBE);
   
   DBE rom_TaughtStatus_Label = label(addROMs_DB, "Taught Status: ");
   attach(rom_TaughtStatus_Label, "l->f;r->u;t->s;b->u", rom_DTOSDate_DBE);
   
   rom_TaughtStatus_DBE = field(addROMs_DB, "", "", 20, true);
   attach(rom_TaughtStatus_DBE, "l->s;r->u;t->s;b->u", rom_TaughtStatus_Label, rom_DTOSDate_DBE);
   
   rom_Counter_DBE = label(addROMs_DB, "\t\t\t\t\t\t\t\t\t");
   attach(rom_Counter_DBE, "l->u;r->f;t->s;b->u", rom_DTOSDate_DBE);
   
   DBE rom_MTD_Label = label(addROMs_DB, "MTD: ");
   attach(rom_MTD_Label, "l->f;r->u;t->s;b->u", rom_TaughtStatus_Label);
   
   rom_MTD_DBE = field(addROMs_DB, "", "", 20, true);
   attach(rom_MTD_DBE, "l->a;r->u;t->s;b->u", rom_TaughtStatus_DBE, rom_TaughtStatus_Label);
   
   DBE rom_Task_Label = label(addROMs_DB, "Task Number: ");
   attach(rom_Task_Label, "l->f;r->u;t->s;b->u", rom_MTD_Label);
   
   rom_Task_DBE = field(addROMs_DB, "", "", 20, true);
   attach(rom_Task_DBE, "l->a;r->u;t->s;b->u", rom_TaughtStatus_DBE, rom_MTD_Label);
   
   DBE rom_SSSN_Label = label(addROMs_DB, "SSSN: ");
   attach(rom_SSSN_Label, "l->f;r->u;t->s;b->u", rom_Task_Label);
   
   rom_SSSN_DBE = field(addROMs_DB, "", "", 20, true);
   attach(rom_SSSN_DBE, "l->a;r->u;t->s;b->u", rom_TaughtStatus_DBE, rom_Task_Label);
   
   rom_NoImpact_DBE = button(addROMs_DB, "No Impact", setNoImpact);
   attach(rom_NoImpact_DBE, "l->u;r->f;t->s;b->u", rom_Task_DBE);
   
   rom_Requirement_DBE = richText(addROMs_DB, "Requirement:", "", 400, 250, true);
   attach(rom_Requirement_DBE, "l->f;r->f;t->s;b->u", rom_SSSN_DBE);
   
   rom_Previous_DBE = button(addROMs_DB, "Review Previous", moveToPreviousObject);
   attach(rom_Previous_DBE, "l->f;r->u;t->s;b->u", rom_Requirement_DBE);
   
   rom_Next_DBE = button(addROMs_DB, "Review Next", moveToNextObject);
   attach(rom_Next_DBE, "l->u;r->f;t->s;b->u", rom_Requirement_DBE);
   
   sep2 = separator(addROMs_DB);
   attach(sep2, "l->f;r->f;t->s;b->u", rom_Previous_DBE);
   
   rom_ChooseLabel_DBE = label(addROMs_DB, "Merge with ROM: \n"   //-
                                 "(Only In-Work ROMs from the\nsame Trainer are listed)");
   attach(rom_ChooseLabel_DBE, "l->f;r->u;t->s;b->u", sep2);
   
   rom_NameLabel_DBE = label(addROMs_DB, "Desired ROM Name:");
   attach(rom_NameLabel_DBE, "l->u;r->f;t->s;b->u", sep2);
   
   rom_Name_DBE = field(addROMs_DB, "", "", 15, false);
   attach(rom_NameLabel_DBE, "l->u;r->f;t->s;b->u", rom_NameLabel_DBE);
   
   rom_Create_DBE = button(addROMs_DB, "Create ROM", createROM, true, 60);
   attach(rom_Create_DBE, "l->u;r->f;t->s;b->u", rom_Name_DBE);
   
   rom_ChooseROM_DBE = choice(addROMs_DB, "", dummy, 0, 25, false);
   attach(rom_ChooseROM_DBE, "l->f;r->u;t->s;b->u", rom_ChooseLabel_DBE);
   
   rom_CreateAll_DBE = button(addROMs_DB, "Create All", createAllROM, true, 60);
   attach(rom_CreateAll_DBE, "l->u;r->f;t->s;b->f", rom_Create_DBE);
   
   rom_MergeWith_DBE = button(addROMs_DB, "Merge with ROM", mergeROM);
   attach(rom_MergeWith_DBE, "l->f;r->u;t->s;b->f", rom_ChooseROM_DBE);
   
   close(addROMs_DB, true, closeDB);
   realize(addROMs_DB);
   inactive(rom_Previous_DBE);
   inactive(rom_MergeWith_DBE);
show(addROMs_DB);

 


AAI Services, Textron
dpechacek@aai.textron.com
David.Pechacek@gmail.com

 


dpechacek - Thu Aug 13 10:14:31 EDT 2009

Re: Issue with DBE placement
dpechacek - Thu Aug 13 11:23:15 EDT 2009

I noticed for the placement of a few of the DBEs I had an 'a' instead of a 's' and the rom_TaughtStatus_DBE instead of rom_TaughtStatus_Label. I fixed that now. Still getting the same problem with the other DBEs.

AAI Services, Textron
dpechacek@sc-aaicorp.com
David.Pechacek@gmail.com

Re: Issue with DBE placement
llandale - Thu Aug 13 11:28:38 EDT 2009

You should be glad I'm such a nit-wit.

At about line 126 you are attaching a DBE to itself. I think you want to change
FROM: attach(rom_NameLabel_DBE, "l->u;r->f;t->s;b->u", rom_NameLabel_DBE);
TO: attach(rom_Name_DBE, "l->u;r->f;t->s;b->u", rom_NameLabel_DBE);

  • Louie

Re: Issue with DBE placement
dpechacek - Thu Aug 13 12:07:45 EDT 2009

llandale - Thu Aug 13 11:28:38 EDT 2009
You should be glad I'm such a nit-wit.

At about line 126 you are attaching a DBE to itself. I think you want to change
FROM: attach(rom_NameLabel_DBE, "l->u;r->f;t->s;b->u", rom_NameLabel_DBE);
TO: attach(rom_Name_DBE, "l->u;r->f;t->s;b->u", rom_NameLabel_DBE);

  • Louie

Thanks louie. Sometimes just takes a different set of eyes.

AAI Services, Textron
dpechacek@aai.textron.com
David.Pechacek@gmail.com

Re: Issue with DBE placement
llandale - Thu Aug 13 12:33:55 EDT 2009

llandale - Thu Aug 13 11:28:38 EDT 2009
You should be glad I'm such a nit-wit.

At about line 126 you are attaching a DBE to itself. I think you want to change
FROM: attach(rom_NameLabel_DBE, "l->u;r->f;t->s;b->u", rom_NameLabel_DBE);
TO: attach(rom_Name_DBE, "l->u;r->f;t->s;b->u", rom_NameLabel_DBE);

  • Louie

Preamble:
[]Take notice of the control knobs of a stove. 'Off' is always pointing up and its very easy to tell when one of the burners is on with just a glance at the stove from across the room.
[] Power plant control monitor panels are the same way. 'OK' for all the round analog displays is 'Up' and even when there are 49 displays in a 7x7 matrix its a breeze to tell at a glance when one of them is 'Bad'.
[] It may be impossible to tell in a croud of 1000 which person is 'slouching', but its easy to tell when there are 1000 army folks all in nice neat rows.

This bug was very hard to find. This highlights a coding technique I'm sure I did not learn in school: make the code easy to read. In this case, I intended my response to look like this:

FROM: attach(rom_NameLabel_DBE, "l->u;r->f;t->s;b->u", rom_NameLabel_DBE);
TO:   attach(rom_Name_DBE,      "l->u;r->f;t->s;b->u", rom_NameLabel_DBE);


which is FAR easier to figure out what needs to be changed than the way it looks in my original post.

In your case, the code would be easier to read if, for each section of your Dialog, you first declared all the DBEs and then placed them; then added white space to line things up. Instead of this:

 

sep2 = separator(addROMs_DB);
attach(sep2, "l->f;r->f;t->s;b->u", rom_Previous_DBE);
   
rom_ChooseLabel_DBE = label(addROMs_DB, "Merge with ROM: \n"   //-
                                 "(Only In-Work ROMs from the\nsame Trainer are listed)");
attach(rom_ChooseLabel_DBE, "l->f;r->u;t->s;b->u", sep2);
   
rom_NameLabel_DBE = label(addROMs_DB, "Desired ROM Name:");
attach(rom_NameLabel_DBE, "l->u;r->f;t->s;b->u", sep2);
   
rom_Name_DBE = field(addROMs_DB, "", "", 15, false);
attach(rom_NameLabel_DBE, "l->u;r->f;t->s;b->u", rom_NameLabel_DBE);   
rom_Create_DBE = button(addROMs_DB, "Create ROM", createROM, true, 60);
attach(rom_Create_DBE, "l->u;r->f;t->s;b->u", rom_Name_DBE);    
   
rom_ChooseROM_DBE = choice(addROMs_DB, "", dummy, 0, 25, false);
attach(rom_ChooseROM_DBE, "l->f;r->u;t->s;b->u", rom_ChooseLabel_DBE);
   
rom_CreateAll_DBE = button(addROMs_DB, "Create All", createAllROM, true, 60);
attach(rom_CreateAll_DBE, "l->u;r->f;t->s;b->f", rom_Create_DBE);
   
rom_MergeWith_DBE = button(addROMs_DB, "Merge with ROM", mergeROM);
attach(rom_MergeWith_DBE, "l->f;r->u;t->s;b->f", rom_ChooseROM_DBE);


Do this:

 

 

sep2                = separator(addROMs_DB);
   
rom_ChooseLabel_DBE = label(addROMs_DB, "Merge with ROM: \n"   //-
                               "(Only In-Work ROMs from the\n" //-
                                "same Trainer are listed)");
   
rom_NameLabel_DBE   = label(addROMs_DB, "Desired ROM Name:");
rom_Name_DBE        = field(addROMs_DB, "", "", 15, false);
rom_Create_DBE      = button(addROMs_DB, "Create ROM", createROM, true, 60);
rom_ChooseROM_DBE   = choice(addROMs_DB, "", dummy, 0, 25, false);
rom_CreateAll_DBE   = button(addROMs_DB, "Create All", createAllROM, true, 60);
rom_MergeWith_DBE   = button(addROMs_DB, "Merge with ROM", mergeROM);
 
attach(sep2,                "l->f;r->f;t->s;b->u", rom_Previous_DBE);
attach(rom_ChooseLabel_DBE, "l->f;r->u;t->s;b->u", sep2);
attach(rom_NameLabel_DBE,   "l->u;r->f;t->s;b->u", sep2);
attach(rom_NameLabel_DBE,   "l->u;r->f;t->s;b->u", rom_NameLabel_DBE);   
attach(rom_Create_DBE,      "l->u;r->f;t->s;b->u", rom_Name_DBE);    
attach(rom_ChooseROM_DBE,   "l->f;r->u;t->s;b->u", rom_ChooseLabel_DBE);
attach(rom_CreateAll_DBE,   "l->u;r->f;t->s;b->f", rom_Create_DBE);
attach(rom_MergeWith_DBE,   "l->f;r->u;t->s;b->f", rom_ChooseROM_DBE);


Noticing the same DBE is attached twice (the 4th 'attach' line) is pretty easy to see.

And, I think, its easier to debug.

 

 

 

  • Louie


Ha! All your semi-colons remind me of my punch-card days. I originally coded in FORTRAN (no semi-colons) and when we went to PL-1 I kept forgetting, and would have to re-punch my cards and stand in line again. So I punched up a bunch of cards with semi-colon in column 70, and only had to remember when NOT to use a semi-colon.

And of course, the main problem with punch-card programs was dropping them! So when the program was working I would put barber-pole markings down the edges, so if ..err.. when I dropped the program I could pretty easily get all the cards very close to where they were supposed to be.

There came a time when a computer program wasn't working and the techs entered the room with all the memory tubes, and found the roach that had died and was lieing across to electrodes, shorting out the connection. Yup, they "De-Bugged" the program and then it worked.

10 years from now the kids will ask "Gads, You really had 'spinning disk' memory?" Or .. "How could you get anything done with a 2-dimensional monitor, a pointer you had to control with your hand, and had to enter text with your fingers instead of just speaking?" lol

 

 

Re: Issue with DBE placement
dpechacek - Fri Aug 14 10:03:49 EDT 2009

llandale - Thu Aug 13 12:33:55 EDT 2009

Preamble:
[]Take notice of the control knobs of a stove. 'Off' is always pointing up and its very easy to tell when one of the burners is on with just a glance at the stove from across the room.
[] Power plant control monitor panels are the same way. 'OK' for all the round analog displays is 'Up' and even when there are 49 displays in a 7x7 matrix its a breeze to tell at a glance when one of them is 'Bad'.
[] It may be impossible to tell in a croud of 1000 which person is 'slouching', but its easy to tell when there are 1000 army folks all in nice neat rows.

This bug was very hard to find. This highlights a coding technique I'm sure I did not learn in school: make the code easy to read. In this case, I intended my response to look like this:

FROM: attach(rom_NameLabel_DBE, "l->u;r->f;t->s;b->u", rom_NameLabel_DBE);
TO:   attach(rom_Name_DBE,      "l->u;r->f;t->s;b->u", rom_NameLabel_DBE);


which is FAR easier to figure out what needs to be changed than the way it looks in my original post.

In your case, the code would be easier to read if, for each section of your Dialog, you first declared all the DBEs and then placed them; then added white space to line things up. Instead of this:

 

sep2 = separator(addROMs_DB);
attach(sep2, "l->f;r->f;t->s;b->u", rom_Previous_DBE);
   
rom_ChooseLabel_DBE = label(addROMs_DB, "Merge with ROM: \n"   //-
                                 "(Only In-Work ROMs from the\nsame Trainer are listed)");
attach(rom_ChooseLabel_DBE, "l->f;r->u;t->s;b->u", sep2);
   
rom_NameLabel_DBE = label(addROMs_DB, "Desired ROM Name:");
attach(rom_NameLabel_DBE, "l->u;r->f;t->s;b->u", sep2);
   
rom_Name_DBE = field(addROMs_DB, "", "", 15, false);
attach(rom_NameLabel_DBE, "l->u;r->f;t->s;b->u", rom_NameLabel_DBE);   
rom_Create_DBE = button(addROMs_DB, "Create ROM", createROM, true, 60);
attach(rom_Create_DBE, "l->u;r->f;t->s;b->u", rom_Name_DBE);    
   
rom_ChooseROM_DBE = choice(addROMs_DB, "", dummy, 0, 25, false);
attach(rom_ChooseROM_DBE, "l->f;r->u;t->s;b->u", rom_ChooseLabel_DBE);
   
rom_CreateAll_DBE = button(addROMs_DB, "Create All", createAllROM, true, 60);
attach(rom_CreateAll_DBE, "l->u;r->f;t->s;b->f", rom_Create_DBE);
   
rom_MergeWith_DBE = button(addROMs_DB, "Merge with ROM", mergeROM);
attach(rom_MergeWith_DBE, "l->f;r->u;t->s;b->f", rom_ChooseROM_DBE);


Do this:

 

 

sep2                = separator(addROMs_DB);
   
rom_ChooseLabel_DBE = label(addROMs_DB, "Merge with ROM: \n"   //-
                               "(Only In-Work ROMs from the\n" //-
                                "same Trainer are listed)");
   
rom_NameLabel_DBE   = label(addROMs_DB, "Desired ROM Name:");
rom_Name_DBE        = field(addROMs_DB, "", "", 15, false);
rom_Create_DBE      = button(addROMs_DB, "Create ROM", createROM, true, 60);
rom_ChooseROM_DBE   = choice(addROMs_DB, "", dummy, 0, 25, false);
rom_CreateAll_DBE   = button(addROMs_DB, "Create All", createAllROM, true, 60);
rom_MergeWith_DBE   = button(addROMs_DB, "Merge with ROM", mergeROM);
 
attach(sep2,                "l->f;r->f;t->s;b->u", rom_Previous_DBE);
attach(rom_ChooseLabel_DBE, "l->f;r->u;t->s;b->u", sep2);
attach(rom_NameLabel_DBE,   "l->u;r->f;t->s;b->u", sep2);
attach(rom_NameLabel_DBE,   "l->u;r->f;t->s;b->u", rom_NameLabel_DBE);   
attach(rom_Create_DBE,      "l->u;r->f;t->s;b->u", rom_Name_DBE);    
attach(rom_ChooseROM_DBE,   "l->f;r->u;t->s;b->u", rom_ChooseLabel_DBE);
attach(rom_CreateAll_DBE,   "l->u;r->f;t->s;b->f", rom_Create_DBE);
attach(rom_MergeWith_DBE,   "l->f;r->u;t->s;b->f", rom_ChooseROM_DBE);


Noticing the same DBE is attached twice (the 4th 'attach' line) is pretty easy to see.

And, I think, its easier to debug.

 

 

 

  • Louie


Ha! All your semi-colons remind me of my punch-card days. I originally coded in FORTRAN (no semi-colons) and when we went to PL-1 I kept forgetting, and would have to re-punch my cards and stand in line again. So I punched up a bunch of cards with semi-colon in column 70, and only had to remember when NOT to use a semi-colon.

And of course, the main problem with punch-card programs was dropping them! So when the program was working I would put barber-pole markings down the edges, so if ..err.. when I dropped the program I could pretty easily get all the cards very close to where they were supposed to be.

There came a time when a computer program wasn't working and the techs entered the room with all the memory tubes, and found the roach that had died and was lieing across to electrodes, shorting out the connection. Yup, they "De-Bugged" the program and then it worked.

10 years from now the kids will ask "Gads, You really had 'spinning disk' memory?" Or .. "How could you get anything done with a 2-dimensional monitor, a pointer you had to control with your hand, and had to enter text with your fingers instead of just speaking?" lol

 

 

Thanks for the tip louie. I'll try to make my code easier for you to read in the future. :)

I know semicolons aren't required for DXL but I use them for good practice since I do other coding at work. Helps me not forget them in languages where they are required (pretty much every other one).

AAI Services, Textron
dpechacek@sc-aaicorp.com
David.Pechacek@gmail.com